#include <vector>
#include <unordered_map>
using namespace std;
class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        unordered_map<int, int> map;
        for (size_t i = 0; i < nums.size(); i++) {
            int choose = nums[i];
            int diff = target - choose;
            if (map.find(diff) != map.end()) {
                return {map[diff], (int)i};
            }
            map[choose] = i;
        }
        return {};
    }
};
    